/*************
Ten tac gia : LY THIEN KIM
Ngay tao : 8/16/2011
Noi dung : update 1 POSTMOTEM

*************/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE NAME = 'sp_UpdatePOSTMOTEM')
BEGIN
	DROP PROC sp_UpdatePOSTMOTEM
END
GO
CREATE PROC sp_UpdatePOSTMOTEM
	@ID				int,
	@IDFIR			int,
	@NAME			varchar(40),
	@SEX			int,
	@ADDRESS		varchar(50),
	@AGE			varchar(40),
	@IMAGE			varchar(40),
	@DOCTOR			varchar(40),
	@RESULT1		text,
	@DATE			datetime,
	@PLACE			varchar(40),
	@Last_updated	datetime,
	@Result			int out
	AS
	BEGIN	
		IF EXISTS (SELECT * FROM POSTMOTEM WHERE ID = @ID and IDFIR = @IDFIR)
		BEGIN
			UPDATE POSTMOTEM SET  NAME = @NAME,@SEX = @SEX,ADDRESS = @ADDRESS,AGE = @AGE,IMAGE = @IMAGE,DOCTOR = @DOCTOR,RESULT = @RESULT1,DATE = @DATE,PLACE = @PLACE,Last_updated = @Last_updated
			WHERE ID = @ID and IDFIR = @IDFIR
			SET @Result = 1	
		END
		else
		BEGIN
			SET @Result = 0
		END
	END